package com.weiyuwqj.server.task;

import com.weiyuwqj.api.service.BasItemService;
import com.weiyuwqj.server.mapper.BasItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by zhangyong on 2016/8/18.
 */
@Component
public class DayItemTask {

    @Autowired
    private BasItemMapper itemMapper;

    @Autowired
    BasItemService itemService;

//    @Scheduled(cron="0 0/1 * * * ? ")
//    public void itemCancel(){
//        List<BasItem> list=itemMapper.getListByEndTime();
//        for (BasItem item : list) {
//            Map map = itemService.cancel(item.getId());
//            if (!map.get("10000").equals("10000")) {
//                map.put("result", "fail");
//                map.put("messageText", map.get("remsg").toString());
//
//            } else {
//                Integer oldStatus = item.getItemStatus();
//                itemMapper.updateItemStatus(oldStatus, ItemStatus.CANCEL, item.getId());
//                itemMapper.updateItemIsalive(0, item.getId());
//            }
//        }
//    }
}
